<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model common\models\CouponCategory */

$this->title = $model->title;
$this->params['breadcrumbs'][] = ['label' => '优惠券分类', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="coupon-category-view">

    <h1><?= Html::encode($this->title) ?></h1>

    <p>
        <?= Html::a('更新', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
        <?= Html::a('删除', ['delete', 'id' => $model->id], [
            'class' => 'btn btn-danger',
            'data' => [
                'confirm' => '确定删除?',
                'method' => 'post',
            ],
        ]) ?>
    </p>

    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            'id',
            'title',
            'mark_id',
            'group_id',
            'origin_num',
            'use_num',

            ['attribute'=>'status','value'=>function($model){

                return  $model->status?'有效':'失效';
            }],
            ['attribute'=>'created_at','value'=>function($model){

                return  date("Y-m-d H:i:s",$model->created_at);
            }],
            ['attribute'=>'updated_at','value'=>function($model){

                return  date("Y-m-d H:i:s",$model->updated_at);
            }],
            'local_mark_id',
            ['attribute'=>'image','format'=>'raw','value'=>function($model){
                return Html::img($model->image,['style'=>'border:0px;width:50px;']);
            }]
        ],
    ]) ?>

</div>
